<style type="text/css">
.pic_box_show
{
    margin: 0px;
    padding: 0px;
}
</style>
<?php
$this->breadcrumbs=array(
//	'Artist Projects'=>array('index'),
//	$model->title,
);
?>
<?php
$artist = $model;
?>
<?php
$image_array = array();
$project_model = ArtistProject::model()->findAllByAttributes(array('artist'=>$artist->id));
foreach($project_model as $project){
    $images_model = ProjectImage::model()->findAllByAttributes(array('project'=>$project->id));
    foreach($images_model as $image){
        $image_array[] = array('image'=>$image->image,'title'=>$project->title,'description'=>$project->description);
    }
}
if(count($image_array) > 0){

    echo '<div id="slideshow"><table border="0" cellspacing="0" cellpadding="0" class="pic_box1">
  <tr>
    <td width="730" height="495" align="center" valign="middle" class="pic_box_show"></td>
  </tr>
</table><table border="0" cellspacing="0" cellpadding="0" class="pic_box2">
  <tr>
    <td width="730" height="495" align="center" valign="middle" class="pic_box_show"></td>
  </tr>
</table><div class="left">'.CHtml::image(Yii::app()->baseUrl.'/images/previous.png').'</div><div class="right">'.CHtml::image(Yii::app()->baseUrl.'/images/next.png').'</div><div class="hover_info"></div></div>';
    echo '<div id="project_info_box">';
    echo '<div class="title_owner"> ';
    echo '<div class="title" id="project_name"></div><div class="owner">'.$artist->name.'</div>';
    echo '</div>';
    echo '<div class="owner_info"> ';
    echo '<div class="website_more"></div><div class="more">'.CHtml::link("More About Project","javascript:;",array('id'=>'project_more_btn')).'</div></div>';
    echo '<div class="clear"></div>';
    echo '<div class="artist_info">'.$artist->io.'</div>';

    $criteria=new CDbCriteria;
    $criteria->condition='artist=:artist';
    $criteria->params=array(':artist'=>$artist->id);
    $criteria->limit = 2;
    $criteria->order = 'id DESC';
    $blog_model = Blog::model()->findAll($criteria);
    if($blog_model != null){
        $index = 0;
        echo '<div class="artist_news">';
        foreach($blog_model as $blog){
            if($index == 0){
                $class_name = 'left';
            }else{
                $class_name = 'right';
            }
            echo '<div class="'.$class_name.'"><h2>'.CHtml::link($blog->title,Yii::app()->createUrl('/blog/view',array('id'=>$blog->id))).'</h2>';
            echo '<p>'.Tool::character_limiter(Tool::delete_htm($blog->discription),130).'</p>';
            if($blog->discription != null){
                echo '<h3>'.CHtml::link('Read More',Yii::app()->createUrl('/blog/view',array('id'=>$blog->id))).'</h3>';
            }
            echo '</div>';
            $index ++;
        }
        echo '</div>';
    }
    
    echo '</div>';
    echo '</div>';
    Yii::app()->clientScript->registerCoreScript('jquery');
    Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl.'/script/slideshow.js');
    $cs = Yii::app()->getClientScript();
    $cs->registerScript(
      'slideshow',
      '
          $(function() {
                $("#slideshow").slideshow({
                    autoplay: "enable",//enable disable
                    time_interval: "5000",
                    start: 0,
                    slide_data: '.json_encode($image_array).',
                    directory: "'.Yii::app()->baseUrl.'/"
                });
            });
      ',
      CClientScript::POS_END
    );
}else{
    echo 'Images is not exist';
}
?>
